<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="TPshop v1.1" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>欢迎语设置</title>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" href="__ROOT__ /AI_radar/css/footer.css">
<link rel="stylesheet" href="__ROOT__ /AI_radar/css/font_my/iconfont.css">
<script type="text/javascript" src="__ROOT__ /AI_radar/js/token.js"></script>

<style type="text/css">
	body,html{
		width: 100%;
		height: 100%;
		margin: 0;
		padding: 0;
		overflow-x: hidden;
		color:#555555;
		background: #fff;
	}
	p{
		margin:0;
	}

	.bian{
		width: calc(100% - 20px);
		padding: 0 10px;
	}
	.greetAdd{
		background: #eee;
	}
	.greetAddYin{
		display: flex;
		background: #eee;
		line-height: 50px;
	}
	.greetAddYinL{
		width: calc(100% - 90px);
		font-weight: bold;
		font-size: 16px
	}
	.greetAddYinR{
		width: 90px;
		text-align: right;
	}
	textarea{
		width: 100%;
		height: 80px;
		resize: none;
		border:none;
	}
	.yanse{
		background: #fff
	}
	

	.greetAddBtn{
		width: calc(100% - 20px);
		line-height: 35px;
		margin: 20px 10px 0 10px;
		text-align: center;
		color: #FFF;
		background: #4f81d4;
		border-radius: 3px;
	}
	.greetAddBot{
		padding: 10px 10px;
		display: flex;
		background: #ddd;
	}
	.greetAddBotL{
		width: 50px;
	}
	.greetAddBotL img{
		width: 40px;
		/*height: 40px;*/
	}
	.greetAddBotR{
		width: calc(100% - 60px);
		padding: 0 5px 0 5px;
	}
	.greetAddBotRs{
		width: calc(100% - 10px);
		padding: 5px;
		 background: #fff;
		 border-radius: 3px;
	}
	.greetAddBotRB{
		line-height: 50px;
		margin-top: 20px;
	}
	.newsSetOne{
		width: calc(90% - 20px);
		padding: 5px 5px;
		display: flex;
		background: #fff;
		/*border-bottom: 1px solid #eaeaea;*/
	}
	.newsSetOneL{
		width: 25px;
	}
	.newsSetOneL img{
		width: 25px;
		height: 25px;
		/*margin: 5px 0 0 5px;*/
	}
	.newsSetOneC{
		width: calc(100% - 35px);
		line-height: 25px;
		text-indent: 10px;
		font-size: 14px;

	}
	.introYin{
		display: flex;
		background: #eee;
		line-height: 50px;
	}
	.introYinL{
		width: calc(100% - 90px);
		font-weight: bold;
		font-size: 16px
	}
	.introYinR{
		width: 90px;
		text-align: right;
	}




	



</style>

</head>
<body>
	{include file="public/wx_share" /}
	<div class="phone">
	<div class="greetAdd">
		<div class="bian introYin">
			<div class="introYinL">我的欢迎语</div>
			<div class="introYinR"><span class="areaK">0</span>/50</div>
		</div>
		<div class="bian yanse">
			<textarea name="" id="aa" maxlength="50"></textarea>
		</div>
		<div class="greetAddBtn">保存</div>
		<div class="bian greetAddYin">
			<div class="greetAddYinL">效果图</div>
			<div class="greetAddYinR"></div>
		</div>
		<div class="bian yanse greetAddBot">
			<div class="greetAddBotL"><img src="__ROOT__ /AI_radar/image/my/tx.png" alt=""></div>
			<div class="greetAddBotR">
				<div class="greetAddBotRs"></div>
				<div class="greetAddBotRB">通过我的名片你还可以：</div>
				<div class="newsSetOne">
					<div class="newsSetOneL">
						<img src="__ROOT__ /AI_radar/image/my/hys.png" alt="">
					</div>
					<div class="newsSetOneC">进入我的名片</div>
				</div>
			</div>
		</div>
	</div>
		<div name="" id="aass"></div>
	</div>

<script src='__ROOT__ /AI_radar/js/jquery.js'></script>
<script type="text/javascript">

	var idNew;
	$.ajax({
	      url:window.urls.url +"/my/welcome/info",
	      type:"POST",
	      contentType: "application/json",
	      dataType:"json",
	      data:JSON.stringify({
	        token:window.tokens.token_boss,
	      }),
	      success:function(res){
	        console.log(res)
			  idNew = res.data.id
	        if(res.data.welcome_word){
	        	$("#aa").val(res.data.welcome_word)
				$(".greetAddBotRs").html(res.data.welcome_word)

	        }
	      },
	      error:function(res){
	        console.log(res)
	      }
  	})
	$('#aa').bind('input propertychange', function() {
        var $this = $(this);
        var text_length = $this.val()
        $(".greetAddBotRs").html(text_length)
        $(".areaK").html(text_length.length)
        if(text_length.length>50){
        	alert("最多只能输入50个字符")
        }
    });
    $(".greetAddBtn").click(function(){
    	var aa = $('#aa').val()
    	console.log(aa,idNew)
    	if(aa.length<5){
			alert("欢迎语内容不能少于5个字符")
			return false;
		}
		if(!idNew){
			idNew = 0
		}

		$.ajax({
	      url:window.urls.url +"/my/welcome/add",
	      type:"POST",
	      contentType: "application/json",
	      dataType:"json",
	      data:JSON.stringify({
	        token:window.tokens.token_boss,
	        id:idNew,
	        welcome_word:aa
	      }),
	      success:function(res){
	        console.log(res)
	        if(res.data){
	        	alert("修改成功")
	        }
			  window.history.go(-1)
          // window.location.href=window.urls.url +`/my/compile?corpid=${localStorage.getItem("CRM_corpId")}`

	       
	      },
	      error:function(res){
			  // alert(res.responseText)
	        	console.log(res)
	      }
  		})
    })


	// console.log($)

</script>
</body>
</html>